﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Altairis.MailToolkit.ListManager.Pages.Admin {
    public partial class HomePage : System.Web.UI.Page {

        protected void Page_Load(object sender, EventArgs e) {
            var items = new List<ListInfo>();
            foreach (MailingListProvider mlp in MailingListManager.Lists) {
                items.Add(new ListInfo {
                    Name = mlp.Name,
                    Description = mlp.Description,
                    MemberCount = mlp.GetMemberCount()
                });
            }
            this.MailingListView.DataSource = items;
            this.MailingListView.DataBind();
        }

        private class ListInfo {
            public string Name { get; set; }
            public string Description { get; set; }
            public int MemberCount { get; set; }
        }

    }


}